import groovy.json.JsonOutput
import groovy.json.JsonSlurper

//def connection = new URL("https://git.devopsing.com.cn/api/v4/users/1696").openConnection() as HttpURLConnection

    def connection = new URL("https://git.devopsing.com.cn/api/v4/groups/smartconstruction/members").openConnection() as HttpURLConnection
    //必须是GET方法
    connection.setRequestMethod("GET")
    connection.setRequestProperty('User-Agent', 'groovy-'.concat(GroovySystem.getVersion()))
    connection.setRequestProperty('Accept', 'application/json')
    //必须设置PRIVATE-TOKEN，不然返回404状态
    connection.setRequestProperty('PRIVATE-TOKEN', '1qfBxwCzmLRknsuFZQXs')
    def response = connection.inputStream.text

    //json处理
    def slurper = new JsonSlurper()
    def result = slurper.parseText(JsonOutput.prettyPrint(response.toString()))
    println(result.toString())

    def email=result.name as String[]
    for(String i in email) {
        println(i);
    }







